Skip to content

[PULP-1254] Serve Python content form a repository version#1336

Open
jobselko wants to merge 2 commits intopulp:mainfrom
jobselko:1324
Open

[PULP-1254] Serve Python content form a repository version#1336
jobselko wants to merge 2 commits intopulp:mainfrom
jobselko:1324

Conversation

@jobselko
Copy link
Contributor

closes #1324

@jobselko jobselko self-assigned this Mar 10, 2026
@jobselko jobselko force-pushed the 1324 branch 4 times, most recently from 0f116b6 to 96c64f6 Compare March 12, 2026 11:59
@jobselko jobselko marked this pull request as ready for review March 12, 2026 12:26
@jobselko jobselko marked this pull request as draft March 12, 2026 13:46
@jobselko jobselko marked this pull request as ready for review March 12, 2026 14:54
@distribution.command()
@apply_decorators(lookup_options + update_options + [click.option("--base-path")])
@pass_entity_context
def update(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this needed? Originally we had to overwrite the update command because pulpcore wouldn't accept a PATCH with publication=None, repository=HREF or vice-versa so we had to break it up into two updates. I think we fixed that now and this workaround should no longer be needed.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated, does it look better now? I had to move some logic to preprocess_entity and kept the first version for now.

context_table={"python:python": PulpPythonRepositoryContext},
help=_(
"Repository to be used for auto-distributing."
" When used with --version, this will create repository_version instead."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
" When used with --version, this will create repository_version instead."
" When used with --version, this will select a repository version instead."

But now with the version set it's no longer "auto-distributing". I think we should rethink the whole string.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I moved the changes to the --version option

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My point is the version option actually changes the interpretation of the repository option even more significantly.

),
repository_option,
pulp_option(
"--version",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if you specify the version and no repository?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

repository_version is created based on the newly provided version and already existing repository (repository is then set to null). This is covered in tests.

if "repository" not in body and "publication" in body:
body["repository"] = None

if self.pulp_ctx.has_plugin(PluginRequirement("python", specifier=">=3.21.0")):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens when you specify --version on pulp_python<3.21?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CLI returns Error: {"version":["Unexpected field"]}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a corresponding "needs_version" to the top of this method?

body["repository_version"] = f"{repository_href}versions/{version}/"
body["repository"] = None
else:
current_entity = getattr(self, "entity", {})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not self.entity?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In fact, i think we should look specifically at the "partial" parameter here.
"partial=True" is used for http "PATCH" calls, where we can assume there is an existing entity.
"partial=False" means either "PUT" (not used by the cli) or "POST" (for create) in which case a version without a repository is invalid.

@@ -0,0 +1 @@
Added support for serving Python content form a repository version.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is part of the "we don't need no publication" effort, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it is more like "we can specify the repository version directly, even without using a publication"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add CLI support for serving python content form a repository version

3 participants